﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.ObjectModel;

namespace VideoRentalShop.Model
{
    public class Movie
    {
        private static readonly DateTime MIN_DATE = new DateTime(1950, 1, 1);


        public Movie()
        {
            Orders = new ObservableCollection<OrderDetails>();
            Genres = new ObservableCollection<GenreDetails>();
            ReleaseDate = MIN_DATE;
        }


        [Required]
        public long Id { get; set; }
        
        [Required]
        [MinLength(1)]
        [MaxLength(100)]
        public string Title { get; set; }

        [MaxLength(100)]
        public string OriginalTitle { get; set; }

        public DateTime? ReleaseDate { get; set; }

        [MaxLength(30)]
        public string OriginCountry { get; set; }

        [Required]
        public int MinAge { get; set; }

        [MaxLength(60)]
        public string Director { get; set; }

        [MaxLength(256)]
        public string PictureName { get; set; }

        [MaxLength(1000)]
        public string Description { get; set; }

        [Required]
        public int Quantity { get; set; }

        [Required]
        public int Avaiable { get; set; }

        public virtual ObservableCollection<OrderDetails> Orders { get; private set; }

        public virtual ObservableCollection<GenreDetails> Genres { get; private set; }
    }
}
